feat: cluster likelihood per-step breakdowns (source-plane + image-plane chi²)#58
Merged
Merged
Conversation
…ane) + scaling tier in simulator likelihood_breakdown/cluster/source_plane.py: FitPositionsSource decomposed (multi-plane ray-trace -> hessian magnifications -> mag-weighted chi2 about the model source centre -> LL with mag-scaled noise norm); per-step LL matches the production fit to 8 digits (rtol 1e-4 assert). Total steady-state 3.1 ms. Three production-formula facts documented en route: chi2 weights distances by |mu|^2; name pairing hands the fit the model Point centre (barycenter only as fallback); noise normalization uses sigma/mu. likelihood_breakdown/cluster/image_plane.py: FitPositionsImagePairRepeat decomposed; triangle-tiling PointSolver solve JIT'd per source plane (compile ~10.5 s, steady ~0.32 s/call at 200x200 @0.7" precision 0.01"); fit totals ~2 s/system. Pytree registration mirrors simulators/cluster.py. simulators/cluster.py: brought to the current standard model — adds the 10-member scaling tier on the reference-anchored relation (autolens_workspace #238 convention, b0_ref=0.12, rs ∝ L^0.5) + writes scaling_galaxies.csv. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PUuWXiS23FvmfQPLvMNjeM
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cluster per-step likelihood breakdowns (issue #57; PyAutoMind
feature/cluster/5_profiling.md— the last pre-LensTool item of the cluster home straight). Newlikelihood_breakdown/cluster/in the house style (per-stepjit_profilelower/compile/first/steady-state, JSON + bar chart intoresults/breakdown/cluster/,AUTOLENS_PROFILING_SMOKE=1short-circuit, CPU fp64):source_plane.py— decomposesFitPositionsSource(Lenstool's default likelihood) for the standard cluster model (2 main dPIE + 10 scaling members + NFW host; sources at z=1/2, multi-plane): per-system multi-plane ray-trace → magnification at the observed positions via the tracer Hessian → magnification-weighted chi² about the model source centre → LL assembly with the magnification-scaled noise normalization. The summed per-step LL is asserted against the eager production fit at rtol=1e-4 — and matches to 8 digits. Getting there surfaced three production-formula facts now documented in the script: the chi² weights residual distances by |μ|², name pairing hands the fit the model's Point centre (barycenter is only the no-profile fallback), and the noise normalization uses σ/μ. Total steady-state cost: 3.1 ms for the 6-image dataset, split roughly between ray-trace and Hessian-magnification steps.image_plane.py— decomposesFitPositionsImagePairRepeat: back-trace setup → the triangle-tiling PointSolver forward-solve JIT-compiled per source plane (dominant; lower/compile/first-call reported separately so the one-off compile a sampler amortises is explicit) → the production fit total per system. Solver at the tutorial-scale grid (200×200 @ 0.7″, precision 0.01″), configuration recorded in the JSON.simulators/cluster.py— brought up to the current standard model: adds the 10-member scaling tier on the reference-anchored relation shipped in autolens_workspace#238 (b0_ref=0.12 anchored at the brightest member, rs ∝ L^0.5) and writesscaling_galaxies.csv; previously this run-time tracker still built the 5-component pre-scaling-tier model.Validation
source_plane.pyend-to-end: per-step LL == productionFitPositionsSourceLL (rtol 1e-4; agreement to 8 significant digits). Artifacts written.image_plane.pyend-to-end: solve + fit totals per system, artifacts written (numbers on the issue).should_simulate).AUTOLENS_PROFILING_SMOKE=1short-circuit verified on both scripts; ruff clean.Validation checklist (--auto run — in-session directives)
profiling-preopt-campaignholds autolens_profiling (diff:likelihood_runtime/sweep.py+scripts/build_baseline.py) — disjoint from this PR's files; re-verified at ship🤖 Generated with Claude Code